package com.example.lxc415billiards.service.impl;

import com.example.lxc415billiards.domain.Goods;
import com.example.lxc415billiards.mapper.GoodsMapper;
import com.example.lxc415billiards.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {

    @Autowired
    private GoodsMapper goodsMapper;

    @Override
    public List<Goods> getAllGoods() {
        return goodsMapper.selectAllGoods();
    }

    @Override
    public Goods getGoodsById(int goodId) {
        return goodsMapper.selectGoodsById(goodId);
    }

    @Override
    public Goods addGoods(Goods goods) {
        goodsMapper.insertGoods(goods);
        return goods;
    }

    @Override
    public void deleteGoodsById(int goodId) {
        goodsMapper.deleteGoodsById(goodId);
    }

    @Override
    public Goods updateGoods(Goods goods) {
        goodsMapper.updateGoods(goods);
        return goods;
    }
}
